package com.wc.算法提高课.E第五章_数学知识.概率与数学期望.扑克牌;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/6 10:16
 * @description https://www.acwing.com/problem/content/description/220/
 */
public class Main {
    /**
     * 思路见:<p>
     *
     * @see com.wc.算法基础课.D第四讲数学知识.数学期望.扑克牌;
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 14, M = 5;
    static double INF = 1e20;
    static double[][][][][][] f = new double[N][N][N][N][M][M];
    static int A, B, C, D;

    public static void main(String[] args) {
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        D = sc.nextInt();

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                for (int k = 0; k < N; k++) {
                    for (int l = 0; l < N; l++) {
                        for (int m = 0; m < M; m++) {
                            Arrays.fill(f[i][j][k][l][m], -1);
                        }
                    }
                }
            }
        }
        double res = dp(0, 0, 0, 0, 0, 0);
        if (res > INF / 2 || !isPass(A, B, C, D)) res = -1;
        out.printf("%.3f", res);
        out.flush();
    }

    static double dp(int a, int b, int c, int d, int x, int y) {
        if (a > 13 || b > 13 || c > 13 || d > 13) return INF;
        if (f[a][b][c][d][x][y] >= 0) return f[a][b][c][d][x][y];
        int as = a + (x == 1 ? 1 : 0) + (y == 1 ? 1 : 0);
        int bs = b + (x == 2 ? 1 : 0) + (y == 2 ? 1 : 0);
        int cs = c + (x == 3 ? 1 : 0) + (y == 3 ? 1 : 0);
        int ds = d + (x == 4 ? 1 : 0) + (y == 4 ? 1 : 0);
        if (as >= A && bs >= B && cs >= C && ds >= D) return f[a][b][c][d][x][y] = 0;
        int sum = 54 - (as + bs + cs + ds);
        if (sum < 0) return f[a][b][c][d][x][y] = INF;
        double v = 1;
        if (a < 13) v += (13.0 - a) / sum * dp(a + 1, b, c, d, x, y);
        if (b < 13) v += (13.0 - b) / sum * dp(a, b + 1, c, d, x, y);
        if (c < 13) v += (13.0 - c) / sum * dp(a, b, c + 1, d, x, y);
        if (d < 13) v += (13.0 - d) / sum * dp(a, b, c, d + 1, x, y);
        if (x == 0) {
            double t = INF;
            for (int i = 1; i < M; i++) t = Math.min(t, 1.0 / sum * dp(a, b, c, d, i, y));
            v += t;
        }
        if (y == 0) {
            double t = INF;
            for (int i = 1; i < M; i++) t = Math.min(t, 1.0 / sum * dp(a, b, c, d, x, i));
            v += t;
        }
        return f[a][b][c][d][x][y] = v;
    }

    static boolean isPass(int a, int b, int c, int d) {
        return pass13(a) + pass13(b) + pass13(c) + pass13(d) <= 2;
    }

    static int pass13(int x) {
        return Math.max(0, x - 13);
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
